home *** CD-ROM | disk | FTP | other *** search
/ TPUG - Toronto PET Users Group / TPUG Users Group CD / TPUG Users Group CD.iso / AMIGA / AMICUS / AMICUS05.ADF / IFF / specsmus < prev    next >
Text File  |  1986-04-20  |  49KB  |  1,145 lines

  1.  
  2. "SMUS" IFF Simple Musical Score
  3.  
  4. Date:     February 5, 1986
  5. From:     Jerry Morrison, Electronic Arts
  6. Status:   Adopted
  7.  
  8. 1. Introduction
  9.  
  10. This is a reference manual for the data interchange format "SMUS", 
  11. which stands for Simple MUsical Score. "EA IFF 85" is Electronic Arts' 
  12. standard for interchange format files. A FORM (or "data section") 
  13. such as FORM SMUS can be an IFF file or a part of one. [See "EA IFF 
  14. 85" Electronic Arts Interchange File Format.]
  15.  
  16. SMUS is a practical data format for uses like moving limited scores 
  17. between programs and storing theme songs for game programs. The format 
  18. should be geared for easy read-in and playback. So FORM SMUS uses 
  19. the compact time encoding of Common Music Notation (half notes, dotted 
  20. quarter rests, etc.). The SMUS format should also be structurally 
  21. simple. So it has no provisions for fancy notational information needed 
  22. by graphical score editors or the more general timing (overlapping 
  23. notes, etc.) and continuous data (pitch bends, etc.) needed by 
  24. performance-oriented MIDI recorders and sequencers.
  25.  
  26. A SMUS score can say which "instruments" are supposed play which notes. 
  27. But the score is independent of whatever output device and driver 
  28. software is used to perform the notes. The score can contain device- 
  29. and driver-dependent instrument data, but this is just a cache. As 
  30. long as a SMUS file stays in one environment, the embedded instrument 
  31. data is very convenient. When you move a SMUS file between programs 
  32. or hardware configurations, the contents of this cache usually become 
  33. useless.
  34.  
  35. Like all IFF formats, SMUS is a filed or "archive" format. It is completely 
  36. independent of score representations in working memory, editing operations, 
  37. user interface, display graphics, computation hardware, and sound 
  38. hardware. Like all IFF formats, SMUS is extensible.
  39.  
  40. SMUS is not an end-all musical score format. Other formats may be 
  41. more appropriate for certain uses. (We'd like to design an general-use 
  42. IFF score format "GSCR". FORM GSCR would encode fancy notational data 
  43. and performance data. There would be a SMUS to/from GSCR converter.)
  44.  
  45. Section 2 gives important background information. Section 3 details 
  46. the SMUS components by defining the required property score header 
  47. "SHDR", the optional text properties name "NAME", copyright "(c) ", 
  48. and author "AUTH", optional text annotation "ANNO", the optional instrument 
  49. specifier "INS1", and the track data chunk "TRAK". Section 4 defines 
  50. some chunks for particular programs to store private information. 
  51. These are "standard" chunks; specialized chunks for future needs can 
  52. be added later. Appendix A is a quick-reference summary. Appendix 
  53. B is an example box diagram. Appendix C names the committee responsible 
  54. for this standard.
  55.  
  56. Update: This standard has been revised since the draft versions. The 
  57. "INST" chunk type was revised to form the "INS1" chunk type. Also, 
  58. several SEvent types and a few text chunk types have been added.
  59.  
  60. Note: This is a MacWrite[tm] 4.5 document. If you strip it down to a 
  61. text file, you'll lose pictures, significant formatting information 
  62. like superscripts, and characters like ")". Don't do it.  
  63.  
  64.  
  65.   ----------------------------------------------------------------
  66.   |(Sorry, EA. We had to strip it down for ease of distribution, |
  67.   |  but we did convert pictures to text-form and where we could |
  68.   |  not do that, we provided ILBM illustrations that people     |
  69.   |  could actually show using the standard "showilbm" program)  |
  70.   ----------------------------------------------------------------
  71.  
  72.  
  73. References:
  74.  
  75. "EA IFF 85" Standard for Interchange Format Files describes the underlying 
  76. conventions for all IFF files.
  77.  
  78. "8SVX" IFF 8-Bit Sampled Voice documents a data format for sampled 
  79. instruments.
  80.  
  81. Electronic Arts[tm] is a trademark of Electronic Arts.
  82.  
  83. MIDI: Musical Instrument Digital Interface Specification 1.0, International 
  84. MIDI Association, 1983.
  85.  
  86. MacWrite[tm] is a trademark of Apple Computer, Inc.
  87.  
  88. SSSP: See various articles on Structured Sound Synthesis Project in 
  89. Foundations of Computer Music.
  90.  
  91.  
  92.  
  93. `0C
  94. 2. Background
  95.  
  96. Here's some background information on score representation in general 
  97. and design choices for SMUS.
  98.  
  99. First, we'll borrow some terminology from the Structured Sound Synthesis 
  100. Project. [See the SSSP reference.] A "musical note" is one kind of 
  101. scheduled event. It's properties include an event duration, an event 
  102. delay, and a timbre object. Theevent duration tells the scheduler 
  103. how long the note should last. The event delay tells how long after 
  104. starting this note to wait before starting the next event. The timbre 
  105. object selects sound driver data for the note; an "instrument" or 
  106. "timbre". A "rest" is a sort of a null event. Its only property is 
  107. an event delay.
  108.  
  109. Classical Event Durations
  110.  
  111. SMUS is geared for "classical" scores, not free-form performances. 
  112. So its event durations are classical (whole note, dotted quarter rest, 
  113. etc.). It can tie notes together to build a "note event" with an unusual 
  114. event duration.
  115.  
  116. The set of useful classical durations is very small. So SMUS needs 
  117. only a handful of bits to encode an event duration. This is very compact. 
  118. It's also very easy to display in Common Music Notation (CMN).
  119.  
  120. Tracks
  121.  
  122. The events in a SMUS score are grouped into parallel "tracks". Each 
  123. track is a linear stream of events.
  124.  
  125. Why use tracks? Tracks serve 4 functions:
  126.  
  127. 1.   Tracks make it possible to encode event delays very compactly. 
  128. A "classical" score has chorded notes and sequential notes; no overlapping 
  129. notes. That is, each event begins either simultaneous with or immediately 
  130. following the previous event in that track. So each event delay is 
  131. either 0 or the same as the event's duration. This binary distinction 
  132. requires only one bit of storage.
  133.  
  134. 2.   Tracks represent the "voice tracks" in Common Music Notation. 
  135. CMN organizes a score in parallel staves, with one or two "voice tracks" 
  136. per staff. So one or two SMUS tracks represents a CMN staff.
  137.  
  138. 3.   Tracks are a good match to available sound hardware. We can 
  139. use "instrument settings" in a track to store the timbre assignments 
  140. for that track's notes. The instrument setting may change over the 
  141. track.
  142.  
  143.      Furthermore, tracks can help to allocate notes among available 
  144. output channels or performance devices or tape recorder "tracks". 
  145. Tracks can also help to adapt polyphonic data to monophonic output 
  146. channels.
  147.  
  148. 4.   Tracks are a good match to simple sound software. Each track 
  149. is a place to hold state settings like "dynamic mark pp ", "time signature 
  150. 3/4", "mute this track", etc., just as it's a context for instrument 
  151. settings. This is a lot like a text stream with running "font" and 
  152. "face" properties (attributes). Running state is usually more compact 
  153. than, say, storing an instrument setting in every note event. It's 
  154. also a useful way to organize "attributes" of notes. With "running 
  155. track state" we can define new note attributes in an upward- and 
  156. backward-compatible way.
  157.  
  158.      Running track state can be expanded (run decoded) while loading 
  159. a track into memory or while playing the track. The runtime track 
  160. state must be reinitialized every time the score is played.
  161.  
  162. Separated vs. interleaved tracks. Multi-track data could be stored 
  163. either as separate event streams or interleaved into one stream. To 
  164. interleave the streams, each event has to carry a "track number" attribute.
  165.  
  166. If we were designing an editable score format, we might interleave 
  167. the streams so that nearby events are stored nearby. This helps when 
  168. searching the data, especially if you can't fit the entire score into 
  169. memory at once. But it takes extra storage for the track numbers and 
  170. may take extra work to manipulate the interleaved tracks.
  171.  
  172. The musical score format FORM SMUS is intended for simple loading 
  173. and playback of small scores that fit entirely in main memory. So 
  174. we chose to store its tracks separately.
  175.  
  176. There can be up to 255 tracks in a FORM SMUS. Each track is stored 
  177. as a TRAK chunk. The count of tracks (the number of TRAK chunks) is 
  178. recorded in the SHDR chunk at the beginning of the FORM SMUS. The 
  179. TRAK chunks appear in numerical order 1, 2, 3, .... This is also priority 
  180. order, most important track first. A player program that can handle 
  181. up to N parallel tracks should read the first N tracks and ignore 
  182. any others.
  183.  
  184. The different tracks in a score may have different lengths. This is 
  185. true both of storage length and of playback duration.
  186.  
  187. Instrument Registers
  188.  
  189. Instrument reference. In SSSP, each note event points to a "timbre 
  190. object" which supplies the "instrument" (the sound driver data) for 
  191. that note. FORM SMUS stores these pointers as a "current instrument 
  192. setting" for each track. It's just a run encoded version of the same 
  193. information. SSSP uses a symbol table to hold all the pointers to 
  194. "timbre object". SMUS uses INS1 chunks for the same purpose. They 
  195. name the score's instruments.
  196.  
  197. The actual instrument data to use depends on the playback environment, 
  198. but we want the score to be independent of environment. Different 
  199. playback environments have different audio output hardware and different 
  200. sound driver software. And there are channel allocation issues like 
  201. how many output channels there are, which ones are polyphonic, and 
  202. which I/O ports they're connected to. If you use MIDI to control the 
  203. instruments, you get into issues of what kind of device is listening 
  204. to each MIDI channel and what each of its preset sounds like. If you 
  205. use computer-based instruments, you need driver-specific data like 
  206. waveform tables and oscillator parameters.
  207.  
  208. We just want to put some orchestration in the score. If the score 
  209. wants a "piano", we let the playback program to find a "piano".
  210.  
  211. Instrument reference by name. A reference from a SMUS score to actual 
  212. instrument data is normally by name. The score simply names the instrument, 
  213. for instance "tubular bells". It's up to the player program to find 
  214. suitable instrument data for its output devices. (More on locating 
  215. instruments below.)
  216.  
  217. Instrument reference by MIDI channel and preset. A SMUS score can 
  218. also ask for a specific MIDI channel number and preset number. MIDI 
  219. programs may honor these specific requests. But these channel allocations 
  220. can become obsolete or the score may be played without MIDI hardware. 
  221. In such cases, the player program should fall back to instrument reference 
  222. by name.
  223.  
  224. Instrument reference via instrument register. Each reference from 
  225. a SMUS track to an instrument is via an "instrument register". Each 
  226. track selects an instrument register which in turn points to the specific 
  227. instrument data.
  228.  
  229. Each score has an array of instrument registers. Each track has a 
  230. "current instrument setting", which is simply an index number into 
  231. this array. This is like setting a raster image's pixel to a specific 
  232. color number (a reference to a color value through a "color register") 
  233. or setting a text character to a specific font number (a reference 
  234. to a font through a "font register"). This is diagrammed below.
  235.  
  236.  
  237.  Track 1  |Set Inst 2| Note | Note | Set Inst 1 | Note | Note | Note |... 
  238.           |                |
  239.   +-------------+               |
  240.   |  +------------------------------------+
  241.   |  |           +--------------------------------------------------------+
  242.   |  +-------->|"piano"  ---------------> (internal piano data)       |
  243.   +----------->|"guitar" ---------------> (internal guitar data) |
  244.             |"Spanish guitar" -------> (internal Spanish guitar data)|
  245.      +-------->|"bass drum" ------------> (internal bass drum data)   |
  246.      |           +--------------------------------------------------------+
  247.      |
  248.      +---------+
  249.             |
  250.  Track 2  |Set Inst 4| Note | Note | Note | Note | Note | Note | Note |... 
  251.  
  252.  
  253.  
  254. Locating instrument data by name. "INS1" chunks in a SMUS score name 
  255. the instruments to use for that score. The player program uses these 
  256. names to locate instrument data.
  257.  
  258. To locate instrument data, the player performs these steps:
  259.  
  260. For each instrument register, check for a suitable instrument with 
  261. the right name.  "Suitable" means usable with an available output 
  262. device and driver.  {Use case independent name comparisons.}
  263.  
  264. 1.   Initialize the instrument register to point to a built-in default 
  265.      instrument.  {Every player program must have default instruments. 
  266.      Simple programs stop here. For fancier programs, the default 
  267.      instruments are a backstop in case the search fails.}
  268.  
  269. 2.   Check any instrument FORMs embedded in the FORM SMUS. (This 
  270.      is an "instrument cache".)
  271.  
  272. 3.   Else check the default instruments.
  273.  
  274. 4.   Else search the local "instrument library". (The library might 
  275.      simply be a disk directory.)
  276.  
  277. 5.   If all else fails, display the desired instrument name and 
  278.      ask the user to pick an available one.
  279.  
  280. This algorithm can be implemented to varying degrees of fanciness. 
  281. It's ok to stop searching after step 1, 2, 3, or 4. If exact instrument 
  282. name matches fail, it's ok to try approximate matches. E.g. search 
  283. for any kind of "guitar" if you can't find a "Spanish guitar". In 
  284. any case, a player only has to search for instruments while loading 
  285. a score.
  286.  
  287. When the embedded instruments are suitable, they save the program 
  288. from asking the user to insert the "right" disk in a drive and searching 
  289. that disk for the "right" instrument. But it's just a cache. In practice, 
  290. we rarely move scores between environments so the cache often works. 
  291. When the score is moved, embedded instruments must be discarded (a 
  292. cache miss) and other instrument data used.
  293.  
  294. Be careful to distinguish an instrument's name from its filenameQthe 
  295. contents name vs. container name. A musical instrument FORM should 
  296. contain a NAME chunk that says what instrument it really is. Its filename, 
  297. on the other hand, is a handle used to locate the FORM. Filenames 
  298. are affected by external factors like drives, directories, and filename 
  299. character and length limits. Instrument names are not.
  300.  
  301. Issue: Consider instrument naming conventions for consistency. Consider 
  302. a naming convention that aids approximate matches. E.g. we could accept 
  303. "guitar, bass1" if we didn't find "guitar, bass". Failing that, we 
  304. could accept "guitar" or any name starting with "guitar".
  305.  
  306. Set instrument events. If the player implements the set-instrument 
  307. score event, each track can change instrument numbers while playing. 
  308. That is, it can switch between the loaded instruments.
  309.  
  310. Initial instrument settings. Each time a score is played, every tracks' 
  311. running state information must be initialized. Specifically, each 
  312. track's instrument number should be initialized to its track number. 
  313. Track 1 to instrument 1, etc. It's as if each track began with a 
  314. set-instrument event.
  315.  
  316. In this way, programs that don't implement the set-instrument event 
  317. still assign an instrument to each track. The INS1 chunks imply these 
  318. initial instrument settings.
  319.  
  320. MIDI Instruments
  321.  
  322. As mentioned above, A SMUS score can also ask for MIDI instruments. 
  323. This is done by putting the MIDI channel and preset numbers in an 
  324. INS1 chunk with the instrument name. Some programs will honor these 
  325. requests while others will just find instruments by name.
  326.  
  327. MIDI Recorder and sequencer programs may simply transcribe the MIDI 
  328. channel and preset commands in a recording session. For this purpose, 
  329. set-MIDI-channel and set-MIDI-preset events can be embedded in a SMUS 
  330. score's tracks. Most programs should ignore these events. An editor 
  331. program that wants to exchange scores with such programs should recognize 
  332. these events. It should let the user change them to the more general 
  333. set-instrument events.
  334.  
  335.  
  336. `0C
  337. 3. Standard Data and Property Chunks
  338.  
  339. A FORM SMUS contains a required property "SHDR" followed by any number 
  340. of parallel "track" data chunks "TRAK". Optional property chunks such 
  341. as "NAME", copyright "(c) ", and instrument reference "INS1" may also 
  342. appear. Any of the properties may be shared over a LIST of FORMs SMUS 
  343. by putting them in a PROP SMUS. [See the IFF reference.]
  344.  
  345. Required Property SHDR
  346.  
  347. The required property "SHDR" holds an SScoreHeader as defined in these 
  348. C declarations and following documentation. An SHDR specifies global 
  349. information for the score. It must appear before the TRAKs in a FORM 
  350. SMUS.
  351.  
  352. #define ID_SMUS MakeID('S', 'M', 'U', 'S')
  353. #define ID_SHDR MakeID('S', 'H', 'D', 'R')
  354.  
  355. typedef struct {
  356.      UWORD tempo;   /* tempo, 128ths quarter note/minute    */
  357.      UBYTE volume;  /* overall playback volume 0 through 127     */
  358.      UBYTE ctTrack; /* count of tracks in the score    */
  359.      } SScoreHeader;
  360.  
  361. [Implementation details. In the C struct definitions in this memo, 
  362. fields are filed in the order shown. A UBYTE field is packed into 
  363. an 8-bit byte. Programs should set all "pad" fields to 0. MakeID is 
  364. a C macro defined in the main IFF document and in the source file 
  365. IFF.h.]
  366.  
  367. The field tempo gives the nominal tempo for all tracks in the score. 
  368. It is expressed in 128ths of a quarter note per minute, i.e. 1 represents 
  369. 1 quarter note per 128 minutes while 12800 represents 100 quarter 
  370. notes per minute. You may think of this as a fixed point fraction 
  371. with a 9-bit integer part and a 7-bit fractional part (to the right 
  372. of the point). A course-tempoed program may simply shift tempo right 
  373. by 7 bits to get a whole number of quarter notes per minute. The tempo 
  374. field can store tempi in the range 0 up to 512. The playback program 
  375. may adjust this tempo, perhaps under user control.
  376.  
  377. Actually, this global tempo could actually be just an initial tempo 
  378. if there are any "set tempo" SEvents inside the score (see TRAK, below). 
  379. Or the global tempo could be scaled by "scale tempo" SEvents inside 
  380. the score. These are potential extensions that can safely be ignored 
  381. by current programs. [See More SEvents To Be Defined, below.]
  382.  
  383. The field volume gives an overall nominal playback volume for all 
  384. tracks in the score. The range of volume values 0 through 127 is like 
  385. a MIDI key velocity value. The playback program may adjust this volume, 
  386. perhaps under direction of a user "volume control".
  387.  
  388. Actually, this global volume level could be scaled by dynamic-mark 
  389. SEvents inside the score (see TRAK, below).
  390.  
  391. The field ctTrack holds the count of tracks, i.e. the number of TRAK 
  392. chunks in the FORM SMUS (see below). This information helps the reader 
  393. prepare for the following data.
  394.  
  395. A playback program will typically load the score and call a driver 
  396. routine PlayScore(tracks, tempo, volume), supplying the tempo and 
  397. volume from the SHDR chunk.
  398.  
  399. Optional Text Chunks NAME, (c), AUTH, ANNO
  400.  
  401. Several text chunks may be included in a FORM SMUS to keep ancillary 
  402. information.
  403.  
  404. The optional property "NAME" names the musical score, for instance 
  405. "Fugue in C".
  406.  
  407. The optional property "(c)J" holds a copyright notice for the score. 
  408. The chunk ID "(c)J" serves the function of the copyright characters 
  409. ")J". E.g. a "(c)J" chunk containing "1986 Electronic Arts" means 
  410. ") 1986 Electronic Arts".
  411.  
  412. The optional property "AUTH" holds the name of the score's author.
  413.  
  414. The chunk types "NAME", "(c) ", and "AUTH" are property chunks. Putting 
  415. more than one NAME (or other) property in a FORM is redundant. Just 
  416. the last NAME counts. A property should be shorter than 256 characters. 
  417. Properties can appear in a PROP SMUS to share them over a LIST of 
  418. FORMs SMUS.
  419.  
  420. The optional data chunk "ANNO" holds any text annotations typed in 
  421. by the author.
  422.  
  423. An ANNO chunk is not a property chunk, so you can put more than one 
  424. in a FORM SMUS. You can make ANNO chunks any length up to 231 - 1 
  425. characters, but 32767 is a practical limit. Since they're not properties, 
  426. ANNO chunks don't belong in a PROP SMUS. That means they can't be 
  427. shared over a LIST of FORMs SMUS.
  428.  
  429. Syntactically, each of these chunks contains an array of 8-bit ASCII 
  430. characters in the range R S (SP, hex 20) through R~S (tilde, hex 7F), 
  431. just like a standard "TEXT" chunk. [See "Strings, String Chunks, and 
  432. String Properties" in "EA IFF 85" Electronic Arts Interchange File 
  433. Format.] The chunk's ckSize field holds the count of characters.
  434.  
  435. #define ID_NAME MakeID('N', 'A', 'M', 'E')
  436. /* NAME chunk contains a CHAR[], the musical score's name.  */
  437.  
  438. #define ID_Copyright MakeID('(', 'c', ')', ' ')
  439. /* "(c) " chunk contains a CHAR[], the FORM's copyright notice.  */
  440.  
  441. #define ID_AUTH MakeID('A', 'U', 'T', 'H')
  442. /* AUTH chunk contains a CHAR[], the name of the score's author. */
  443.  
  444. #define ID_ANNO MakeID('A', 'N', 'N', 'O')
  445. /* ANNO chunk contains a CHAR[], author's text annotations. */
  446.  
  447. Remember to store a 0 pad byte after any odd-length chunk.
  448.  
  449. Optional Property INS1
  450.  
  451. The "INS1" chunks in a FORM SMUS identify the instruments to use for 
  452. this score. A program can ignore INS1 chunks and stick with its built-in 
  453. default instrument assignments. Or it can use them to locate instrument 
  454. data. [See "Instrument Registers" in section 2, above.]
  455.  
  456. #define ID_INS1 MakeID('I', 'N', 'S', '1')
  457.  
  458. /* Values for the RefInstrument field "type".     */
  459. #define INS1_Name  0     /* just use the name; ignore data1, data2    */
  460. #define INS1_MIDI  1     /* <<data1, data2> = MIDI <<channel, preset> */
  461.  
  462. typedef struct {
  463.      UBYTE register;     /* set this instrument register number  */
  464.      UBYTE type;    /* instrument reference type  */
  465.      UBYTE data1, data2; /* depends on the "type" field     */
  466.      CHAR  name[];  /* instrument name  */
  467.      } RefInstrument;
  468.  
  469. An INS1 chunk names the instrument for instrument register number 
  470. register. The register field can range from 0 through 255. In practice, 
  471. most scores will need only a few instrument registers.
  472.  
  473. The name field gives a text name for the instrument. The string length 
  474. can be determined from the ckSize of the INS1 chunk. The string is 
  475. simply an array of 8-bit ASCII characters in the range R S (SP, hex 
  476. 20) through R~S (tilde, hex 7F).
  477.  
  478. Besides the instrument name, an INS1 chunk has two data numbers to 
  479. help locate an instrument. The use of these data numbers is controlled 
  480. by the type field. A value type = INS1_Name means just find an instrument 
  481. by name. In this case, data1 and data2 should just be set to 0. A 
  482. value type = INS1_MIDI means look for an instrument on MIDI channel 
  483. # data1, preset # data2. Programs and computers without MIDI outputs 
  484. will just ignore the MIDI data. They'll always look for the named 
  485. instrument. Other values of the type field are reserved for future 
  486. standardization.
  487.  
  488. See section 2, above, for the algorithm for locating instrument data 
  489. by name.
  490.  
  491. Obsolete Property INST
  492.  
  493. The chunk type "INST" is obsolete in SMUS. It was revised to form 
  494. the "INS1" chunk.
  495.  
  496. Data Chunk TRAK
  497.  
  498. The main contents of a score is stored in one or more TRAK chunks 
  499. representing parallel "tracks". One TRAK chunk per track.
  500.  
  501. The contents of a TRAK chunk is an array of 16-bit "events" such as 
  502. "note", "rest", and "set instrument". Events are really commands to 
  503. a simple scheduler, stored in time order. The tracks can be polyphonic, 
  504. that is, they can contain chorded "note" events.
  505.  
  506. Each event is stored as an "SEvent" record. ("SEvent" means "simple 
  507. musical event".) Each SEvent has an 8-bit type field called an "sID" 
  508. and 8 bits of type-dependent data. This is like a machine language 
  509. instruction with an 8-bit opcode and an 8-bit operand.
  510.  
  511. This format is extensible since new event types can be defined in 
  512. the future. The "note" and "rest" events are the only ones that every 
  513. program must understand. We will carefully design any new event types 
  514. so that programs can safely skip over unrecognized events in a score.
  515.  
  516. Caution: SID codes must be allocated by a central clearinghouse to 
  517. avoid conflicts.
  518.  
  519. Here are the C type definitions for TRAK and SEvent and the currently 
  520. defined sID values. Afterward are details on each SEvent.
  521.  
  522. #define ID_TRAK MakeID('T', 'R', 'A', 'K')
  523.  
  524. /* TRAK chunk contains an SEvent[].     */
  525.  
  526. /* SEvent: Simple musical event.   */
  527. typedef struct {
  528.      UBYTE sID;     /* SEvent type code */
  529.      UBYTE data;    /* sID-dependent data    */
  530.      } SEvent;
  531.  
  532. /* SEvent type codes "sID".        */
  533. #define SID_FirstNote     0
  534. #define SID_LastNote    127   /* sIDs in the range SID_FirstNote through
  535.                      * SID_LastNote (sign bit = 0) are notes. The
  536.                      * sID is the MIDI tone number (pitch). */
  537. #define SID_Rest        128   /* a rest (same data format as a note). */
  538.  
  539. #define SID_Instrument  129   /* set instrument number for this 
  540. track.    */
  541. #define SID_TimeSig     130   /* set time signature for this track.   */
  542. #define SID_KeySig      131   /* set key signature for this track.    */
  543. #define SID_Dynamic     132   /* set volume for this track. */
  544. #define SID_MIDI_Chnl   133   /* set MIDI channel number (sequencers) */
  545. #define SID_MIDI_Preset 134   /* set MIDI preset number (sequencers)  */
  546.  
  547. /* SID values 144 through 159: reserved for Instant Music SEvents.    */
  548.  
  549. /* Remaining sID values up through 254: reserved for future
  550.  * standardization.      */
  551.  
  552. #define SID_Mark        255   /* sID reserved for an end-mark in RAM. */
  553.  
  554. Note and Rest SEvents
  555.  
  556. The note and rest SEvents SID_FirstNote through SID_Rest have the 
  557. following structure overlaid onto the SEvent structure:
  558.  
  559. typedef struct {
  560.      UBYTE    tone; /* MIDI tone number 0 to 127; 128 = rest     */
  561.      unsigned chord    :1,    /* 1 = a chorded note    */
  562.         tieOut   :1,     /* 1 = tied to the next note or chord   */
  563.         nTuplet  :2,     /* 0 = none, 1 = triplet, 2 = quintuplet,
  564.      * 3 = septuplet     */
  565.         dot      :1,     /* dotted note; multiply duration by 3/2     */
  566.         division :3;     /* basic note duration is 2-division: 0 = whole
  567.                 * note, 1 = half note, 2 = quarter note, I 
  568.                 * 7 = 128th note   */
  569.      } SNote;
  570.  
  571. [Implementation details. Unsigned ":n" fields are packed into n bits 
  572. in the order shown, most significant bit to least significant bit. 
  573. An SNote fits into 16 bits like any other SEvent. Warning: Some compilers 
  574. don't implement bit-packed fields properly. E.g. Lattice 68000 C pads 
  575. a group of bit fields out to a LONG, which would make SNote take 5-bytes! 
  576. In that situation, use the bit-field constants defined below.]
  577.  
  578. The SNote structure describes one "note" or "rest" in a track. The 
  579. field SNote.tone, which is overlaid with the SEvent.sID field, indicates 
  580. the MIDI tone number (pitch) in the range 0 through 127. A value of 
  581. 128 indicates a rest.
  582.  
  583. The fields nTuplet, dot, and division together give the duration of 
  584. the note or rest. The division gives the basic duration: whole note, 
  585. half note, etc. The dot indicates if the note or rest is dotted. A 
  586. dotted note is 3/2 as long as an undotted note. The value nTuplet 
  587. (0 through 3) tells if this note or rest is part of an N-tuplet of 
  588. order 1 (normal), 3, 5, or 7; an N-tuplet of order (2J*JnTupletJ+J1). 
  589. A triplet note is 2/3 as long as a normal note, while a quintuplet 
  590. is 4/5 as long and a septuplet is 6/7 as long.
  591.  
  592. Putting these three fields together, the duration of the note or rest 
  593. is 2-division * {1, 3/2} * {1, 2/3, 4/5, 6/7}
  594.  
  595. These three fields are contiguous so you can easily convert to your 
  596. local duration encoding by using the combined 6 bits as an index into 
  597. a mapping table.
  598.  
  599. The field chord indicates if the note is chorded with the following 
  600. note (which is supposed to have the same duration). A group of notes 
  601. may be chorded together by setting the chord bit of all but the last 
  602. one. (In the terminology of SSSP and GSCR, setting the chord bit to 
  603. 1 makes the "entry delay" 0.) A monophonic-track player can simply 
  604. ignore any SNote event whose chord bit is set, either by discarding 
  605. it when reading the track or by skipping it when playing the track.
  606.  
  607. Programs that create polyphonic tracks are expected to store the most 
  608. important note of each chord last, which is the note with the 0 chord 
  609. bit. This way, monophonic programs will play the most important note 
  610. of the chord. The most important note might be the chord's root note 
  611. or its melody note.
  612.  
  613. If the field tieOut is set, the note is tied to the following note 
  614. in the track if the following note has the same pitch. A group of 
  615. tied notes is played as a single note whose duration is the sum of 
  616. the component durations. Actually, the tie mechanism ties a group 
  617. of one or more chorded notes to another group of one or more chorded 
  618. notes. Every note in a tied chord should have its tieOut bit set.
  619.  
  620. Of course, the chord and tieOut fields don't apply to SID_Rest SEvents.
  621.  
  622. Programs should be robust enough to ignore an unresolved tie, i.e. 
  623. a note whose tieOut bit is set but isn't followed by a note of the 
  624. same pitch. If that's true, monophonic-track programs can simply ignore 
  625. chorded notes even in the presense of ties. That is, tied chords pose 
  626. no extra problems.
  627.  
  628. The following diagram shows some combinations of notes and chords 
  629. tied to notes and chords. The text below the staff has a column for 
  630. each SNote SEvent to show the pitch, chord bit, and tieOut bit.
  631.  
  632.  
  633.  
  634.           (figure)
  635.  
  636.  
  637.  
  638.  
  639. If you read the above track into a monophonic-track program, it'll 
  640. strip out the chorded notes and ignore unresolved ties. You'll end 
  641. up with:
  642.  
  643.  
  644.  
  645.           (figure)
  646.  
  647.  
  648.  
  649.  
  650. A rest event (sID = SID_Rest) has the same SEvent.data field as a 
  651. note. It tells the duration of the rest. The chord and tieOut fields 
  652. of rest events are ignored.
  653.  
  654. Within a TRAK chunk, note and rest events appear in time order.
  655.  
  656. Instead of the bit-packed structure SNote, it might be easier to assemble 
  657. data values by or-ing constants and to disassemble them by masking 
  658. and shifting. In that case, use the following definitions.
  659.  
  660. #define noteChord  (1<<<<7)   /* note is chorded to next note    */
  661.  
  662. #define noteTieOut (1<<<<6)   /* tied to next note/chord    */
  663.  
  664. #define noteNShift 4     /* shift count for nTuplet field   */
  665. #define noteN3     (1<<<<noteNShift)    /* note is a triplet     */
  666. #define noteN5     (2<<<<noteNShift)    /* note is a quintuplet  */
  667. #define noteN7     (3<<<<noteNShift)    /* note is a septuplet   */
  668. #define noteNMask  noteN7     /* bit mask for the nTuplet field  */
  669.  
  670. #define noteDot    (1<<<<3)   /* note is dotted   */
  671.  
  672. #define noteD1     0     /* whole note division   */
  673. #define noteD2     1     /* half note division    */
  674. #define noteD4     2     /* quarter note division */
  675. #define noteD8     3     /* eighth note division  */
  676. #define noteD16    4     /* sixteenth note division    */
  677. #define noteD32    5     /* thirty-secondth note division   */
  678. #define noteD64    6     /* sixty-fourth note division */
  679. #define noteD128   7     /* 1/128 note division   */
  680. #define noteDMask  noteD128   /* bit mask for the division field */
  681.  
  682. #define noteDurMask 0x3F /* mask for combined duration fields    */
  683.  
  684. Note: The remaining SEvent types are optional. A writer program doesn't 
  685. have to generate them. A reader program can safely ignore them.
  686.  
  687. Set Instrument SEvent
  688.  
  689. One of the running state variables of every track is an instrument 
  690. number. An instrument number is the array index of an "instrument 
  691. register", which in turn points to an instrument. (See "Instrument 
  692. Registers", in section 2.) This is like a color number in a bitmap; 
  693. a reference to a color through a "color register".
  694.  
  695. The initial setting for each track's instrument number is the track 
  696. number. Track 1 is set to instrument 1, etc. Each time the score is 
  697. played, every track's instrument number should be reset to the track 
  698. number.
  699.  
  700. The SEvent SID_Instrument changes the instrument number for a track, 
  701. that is, which instrument plays the following notes. Its SEvent.data 
  702. field is an instrument register number in the range 0 through 255. 
  703. If a program doesn't implement the SID_Instrument event, each track 
  704. is fixed to one instrument.
  705.  
  706. Set Time Signature SEvent
  707.  
  708. The SEvent SID_TimeSig sets the time signature for the track. A "time 
  709. signature" SEvent has the following structure overlaid on the SEvent 
  710. structure:
  711.  
  712. typedef struct {
  713.      UBYTE    type; /* = SID_TimeSig    */
  714.      unsigned timeNSig :5,    /* time sig. "numerator" is timeNSig + 1 */ 
  715.      timeDSig :3;   /* time sig. "denominator" is 2timeDSig: 
  716.                 * 0 = whole note, 1 = half note, 2 = quarter      
  717.                 * note, I 7 = 128th note     */
  718.      } STimeSig;
  719.  
  720. [Implementation details. Unsigned ":n" fields are packed into n bits 
  721. in the order shown, most significant bit to least significant bit. 
  722. An STimeSig fits into 16 bits like any other SEvent. Warning: Some 
  723. compilers don't implement bit-packed fields properly. E.g. Lattice 
  724. C pads a group of bit fields out to a LONG, which would make an STimeSig 
  725. take 5-bytes! In that situation, use the bit-field constants defined 
  726. below.]
  727.  
  728. The field type contains the value SID_TimeSig, indicating that this 
  729. SEvent is a "time signature" event. The field timeNSig indicates the 
  730. time signature "numerator" is timeNSig + 1, that is, 1 through 32 
  731. beats per measure. The field timeDSig indicates the time signature 
  732. "denominator" is 2timeDSig, that is each "beat" is a 2-timeDSig note 
  733. (see SNote division, above). So 4/4 time is expressed as timeNSig 
  734. = 3, timeDSig = 2.
  735.  
  736. The default time signature is 4/4 time.
  737.  
  738. Beware that the time signature has no effect on the score's playback. 
  739. Tempo is uniformly expressed in quarter notes per minute, independent 
  740. of time signature. (Quarter notes per minute equals beats per minute 
  741. only if timeDSig = 2, n/4 time). Nonetheless, any program that has 
  742. time signatures should put them at the beginning of each TRAK when 
  743. creating a FORM SMUS because music editors need them.
  744.  
  745. Instead of the bit-packed structure STimeSig, it might be easier to 
  746. assemble data values by or-ing constants and to disassemble them by 
  747. masking and shifting. In that case, use the following definitions.
  748.  
  749. #define timeNMask  0xF8  /* bit mask for the timeNSig field */
  750. #define timeNShift 3     /* shift count for  timeNSig field */
  751.  
  752. #define timeDMask  0x07  /* bit mask for the timeDSig field */
  753.  
  754. Key Signature SEvent
  755.  
  756. An SEvent SID_KeySig sets the key signature for the track. Its data 
  757. field is a UBYTE number encoding a major key:
  758.  
  759. data key  music notation data key  music notation
  760. J0   C maj
  761. J1   G    #    J8   F    b
  762. J2   D    ##   J9   Bb   bb
  763. J3   A    ###  10   Eb   bbb
  764. J4   E    #### 11   Ab   bbbb
  765. J5   B    #####     12   Db   bbbbb
  766. J6   F#   ######    13   Gb   bbbbbb
  767. J7   C#   #######   14   Cb   bbbbbbb
  768.  
  769. A SID_KeySig SEvent changes the key for the following notes in that 
  770. track. C major is the default key in every track before the first 
  771. SID_KeySig SEvent.
  772.  
  773. Dynamic Mark SEvent
  774.  
  775. An SEvent SID_Dynamic represents a dynamic mark like ppp and fff in 
  776. Common Music Notation. Its data field is a MIDI key velocity number 
  777. 0 through 127. This sets a "volume control" for following notes in 
  778. the track. This "track volume control" is scaled by the overall score 
  779. volume in the SHDR chunk.
  780.  
  781. The default dynamic level is 127 (full volume).
  782.  
  783. Set MIDI Channel SEvent
  784.  
  785. The SEvent SID_MIDI_Chnl is for recorder programs to record the set-MIDI-channe
  786. l low level event. The data byte contains a MIDI channel number. Other 
  787. programs should use instrument registers instead.
  788.  
  789. Set MIDI Preset SEvent
  790.  
  791. The SEvent SID_MIDI_Preset is for recorder programs to record the 
  792. set-MIDI-preset low level event. The data byte contains a MIDI preset 
  793. number. Other programs should use instrument registers instead.
  794.  
  795. Instant Music Private SEvents
  796.  
  797. Sixteen SEvents are used for private data for the Instant Music program. 
  798. SID values 144 through 159 are reserved for this purpose. Other programs 
  799. should skip over these SEvents.
  800.  
  801. End-Mark SEvent
  802.  
  803. The SEvent type SID_Mark is reserved for an end marker in working 
  804. memory. This event is never stored in a file. It may be useful if 
  805. you decide to use the filed TRAK format intact in working memory.
  806.  
  807. More SEvents To Be Defined
  808.  
  809. More SEvents can be defined in the future. The sID codes 133 through 
  810. 143 and 160 through 254 are reserved for future needs. Caution: sID 
  811. codes must be allocated by a central "clearinghouse" to avoid conflicts. 
  812. When this SMUS standard passes the "draft" state, Commodore-Amiga 
  813. will be in charge of this activity.
  814.  
  815. The following SEvent types are under consideration and should not 
  816. yet be used.
  817.  
  818. Issue: A "change tempo" SEvent changes tempo during a score. Changing 
  819. the tempo affects all tracks, not just the track containing the change 
  820. tempo event.
  821.  
  822. One possibility is a "scale tempo" SEvent SID_ScaleTempo that rescales 
  823. the global tempo:
  824. currentTempo := globalTempo * (data + 1) / 128
  825.  
  826. This can scale the global tempo (in the SHDR) anywhere from x1/128 
  827. to x2 in roughly 1% increments.
  828.  
  829. An alternative is two events SID_SetHTempo and SID_SetLTempo. SID_SetHTempo 
  830. gives the high byte and SID_SetLTempo gives the low byte of a new 
  831. tempo setting, in 128ths quarter note/minute. SetHTempo automatically 
  832. sets the low byte to 0, so the SetLTempo event isn't needed for course 
  833. settings. In this scheme, the SHDR's tempo is simply a starting tempo.
  834.  
  835. An advantage of SID_ScaleTempo is that the playback program can just 
  836. alter the global tempo to adjust the overall performance time and 
  837. still easily implement tempo variations during the score. But the 
  838. "set tempo" SEvent may be simpler to generate.
  839.  
  840. Issue: The events SID_BeginRepeat and SID_EndRepeat define a repeat 
  841. span for one track. The span of events between a BeginRepeat and an 
  842. EndRepeat is played twice. The SEvent.data field in the BeginRepeat 
  843. event could give an iteration count,1 through 255 times or 0 for "repeat 
  844. forever".
  845.  
  846. Repeat spans can be nested. All repeat spans automatically end at 
  847. the end of the track.
  848.  
  849. An event SID_Ending begins a section like "first ending" or "second 
  850. ending". The SEvent.data field gives the ending number. This SID_Ending 
  851. event only applies to the innermost repeat group. (Consider generalizing 
  852. it.)
  853.  
  854. A more general alternative is a "subtrack" or "subscore" event. A 
  855. "subtrack" event is essentially a "subroutine call" to another series 
  856. of SEvents. This is a nice way to encode all the possible variations 
  857. of repeats, first endings, codas, and such.
  858.  
  859. To define a subtrack, we must demark its start and end. One possibility 
  860. is to define a relative brach-to-subtrack event SID_BSR and a return-from-subtr
  861. ack event SID_RTS. The 8-bit data field in the SID_BSR event can reach 
  862. as far as 512 SEvents. A second possibility is to call a subtrack 
  863. by index number, with an IFF chunk outside the TRAK defining the start 
  864. and end of all subtracks. This is very general since a portion of 
  865. one subtrack can be used as another subtrack. It also models the tape 
  866. recording practice of first "laying down a track" and then selecting 
  867. portions of it to play and repeat. To embody the music theory idea 
  868. of playing a sequence like "ABBA", just compose the "main" track entirely 
  869. of subtrack events. A third possibility is to use a numbered subtrack 
  870. chunk "STRK" for each subroutine.
  871.  
  872.  
  873.  
  874. `0C
  875. 4. Private Chunks
  876.  
  877. As in any IFF FORM, there can be private chunks in a FORM SMUS that 
  878. are designed for one particular program to store its private information. 
  879. All IFF reader programs skip over unrecognized chunks, so the presense 
  880. of private chunks can't hurt.
  881.  
  882. Instant Music stores some global score information in a chunk of ID 
  883. "IRev".
  884.  
  885.  
  886. `0C
  887. Appendix A. Quick Reference
  888.  
  889. Type Definitions
  890.  
  891. Here's a collection of the C type definitions in this memo. In the 
  892. "struct" type definitions, fields are filed in the order shown. A 
  893. UBYTE field is packed into an 8-bit byte. Programs should set all 
  894. "pad" fields to 0.
  895.  
  896. #define ID_SMUS MakeID('S', 'M', 'U', 'S')
  897. #define ID_SHDR MakeID('S', 'H', 'D', 'R')
  898.  
  899. typedef struct {
  900.      UWORD tempo;   /* tempo, 128ths quarter note/minute    */
  901.      UBYTE volume;  /* overall playback volume 0 through 127     */
  902.      UBYTE ctTrack; /* count of tracks in the score    */
  903.      } SScoreHeader;
  904.  
  905. #define ID_NAME MakeID('N', 'A', 'M', 'E')
  906. /* NAME chunk contains a CHAR[], the musical score's name.  */
  907.  
  908. #define ID_Copyright MakeID('(', 'c', ')', ' ')
  909. /* "(c) " chunk contains a CHAR[], the FORM's copyright notice.  */
  910.  
  911. #define ID_AUTH MakeID('A', 'U', 'T', 'H')
  912. /* AUTH chunk contains a CHAR[], the name of the score's author. */
  913.  
  914. #define ID_ANNO MakeID('A', 'N', 'N', 'O')
  915. /* ANNO chunk contains a CHAR[], author's text annotations. */
  916.  
  917. #define ID_INS1 MakeID('I', 'N', 'S', '1')
  918.  
  919. /* Values for the RefInstrument field "type".     */
  920. #define INS1_Name 0 /* just use the name; ignore data1, data2    */
  921. #define INS1_MIDI 1 /* <<data1, data2> = MIDI <<channel, preset> */
  922.  
  923. typedef struct {
  924.      UBYTE register;     /* set this instrument register number  */
  925.      UBYTE type;    /* instrument reference type  */
  926.      UBYTE data1, data2; /* depends on the "type" field     */
  927.      CHAR  name[];  /* instrument name  */
  928.      } RefInstrument;
  929.  
  930. #define ID_TRAK MakeID('T', 'R', 'A', 'K')
  931. /* TRAK chunk contains an SEvent[].     */
  932.  
  933. /* SEvent: Simple musical event.   */
  934. typedef struct {
  935.      UBYTE sID;     /* SEvent type code */
  936.      UBYTE data;    /* sID-dependent data    */
  937.      } SEvent;
  938.  
  939. /* SEvent type codes "sID".        */
  940. #define SID_FirstNote     0
  941. #define SID_LastNote    127   /* sIDs in the range SID_FirstNote through
  942.                      * SID_LastNote (sign bit = 0) are notes. The 
  943.                      * sID is the MIDI tone number (pitch). */
  944. #define SID_Rest        128   /* a rest (same data format as a note). */
  945.  
  946. #define SID_Instrument  129   /* set instrument number for this 
  947. track.    */
  948. #define SID_TimeSig     130   /* set time signature for this track.   */
  949. #define SID_KeySig      131   /* set key signature for this track.    */
  950. #define SID_Dynamic     132   /* set volume for this track. */
  951. #define SID_MIDI_Chnl   133   /* set MIDI channel number (sequencers) */
  952. #define SID_MIDI_Preset 134   /* set MIDI preset number (sequencers)  */
  953.  
  954. /* SID values 144 through 159: reserved for Instant Music SEvents.    */
  955.  
  956. /* Remaining sID values up through 254: reserved for future
  957.  * standardization.      */
  958.  
  959. #define SID_Mark        255   /* sID reserved for an end-mark in RAM. */
  960.  
  961. /* SID_FirstNote..SID_LastNote, SID_Rest SEvents  */
  962. typedef struct {
  963.      UBYTE    tone; /* MIDI tone number 0 to 127; 128 = rest     */
  964.      unsigned chord    :1,    /* 1 = a chorded note    */
  965.         tieOut   :1,     /* 1 = tied to the next note or chord   */
  966.         nTuplet  :2,     /* 0 = none, 1 = triplet, 2 = quintuplet,
  967.                 * 3 = septuplet    */
  968.         dot      :1,     /* dotted note; multiply duration by 3/2     */
  969.         division :3;     /* basic note duration is 2-division: 0 = whole
  970.                 * note, 1 = half note, 2 = quarter note, I 
  971.                 * 7 = 128th note   */
  972.      } SNote;
  973.  
  974. #define noteChord  (1<<<<7)   /* note is chorded to next note    */
  975.  
  976. #define noteTieOut (1<<<<6)   /* tied to next note/chord    */
  977.  
  978. #define noteNShift 4     /* shift count for nTuplet field   */
  979. #define noteN3     (1<<<<noteNShift)    /* note is a triplet     */
  980. #define noteN5     (2<<<<noteNShift)    /* note is a quintuplet  */
  981. #define noteN7     (3<<<<noteNShift)    /* note is a septuplet   */
  982. #define noteNMask  noteN7     /* bit mask for the nTuplet field  */
  983.  
  984. #define noteDot    (1<<<<3)   /* note is dotted   */
  985.  
  986. #define noteD1     0     /* whole note division   */
  987. #define noteD2     1     /* half note division    */
  988. #define noteD4     2     /* quarter note division */
  989. #define noteD8     3     /* eighth note division  */
  990. #define noteD16    4     /* sixteenth note division    */
  991. #define noteD32    5     /* thirty-secondth note division   */
  992. #define noteD64    6     /* sixty-fourth note division */
  993. #define noteD128   7     /* 1/128 note division   */
  994. #define noteDMask  noteD128   /* bit mask for the division field */
  995.  
  996. #define noteDurMask 0x3F /* mask for combined duration fields    */
  997.  
  998. /* SID_Instrument SEvent      */
  999. /* "data" value is an instrument register number 0 through 255.  */
  1000.  
  1001. /* SID_TimeSig SEvent         */
  1002. typedef struct {
  1003.      UBYTE    type; /* = SID_TimeSig    */
  1004.      unsigned timeNSig :5,    /* time sig. "numerator" is timeNSig + 1 */
  1005.         timeDSig :3;     /* time sig. "denominator" is 2timeDSig:
  1006.                 * 0 = whole note, 1 = half note, 2 = quarter      
  1007.                 * note, I 7 = 128th note     */
  1008.      } STimeSig;
  1009.  
  1010. #define timeNMask  0xF8  /* bit mask for the timeNSig field */
  1011. #define timeNShift 3     /* shift count for  timeNSig field */
  1012.  
  1013. #define timeDMask  0x07  /* bit mask for the timeDSig field */
  1014.  
  1015. /* SID_KeySig SEvent          */
  1016. /* "data" value 0 = Cmaj; 1 through 7 = G,D,A,E,B,F#,C#;
  1017.  * 8 through 14 = F,Bb,Eb,Ab,Db,Gb,Cb.  */
  1018.  
  1019. /* SID_Dynamic SEvent         */
  1020. /* "data" value is a MIDI key velocity 0..127.    */
  1021.  
  1022. SMUS Regular Expression
  1023.  
  1024. Here's a regular expression summary of the FORM SMUS syntax. This 
  1025. could be an IFF file or part of one.
  1026.  
  1027. SMUS ::= "FORM" #{  "SMUS" SHDR [NAME] [Copyright] [AUTH] [IRev]
  1028.           ANNO* INS1*  TRAK*  InstrForm* }
  1029.  
  1030. SHDR ::= "SHDR" #{  SScoreHeader   }
  1031. NAME ::= "NAME" #{  CHAR*     } [0]
  1032. Copyright ::= "(c) " #{  CHAR*     } [0]
  1033. AUTH ::= "AUTH" #{  CHAR*     } [0]
  1034. IRev ::= "IRev" #{  ...  }
  1035.  
  1036. ANNO ::= "ANNO" #{  CHAR*     } [0]
  1037. INS1 ::= "INS1" #{  RefInstrument  } [0]
  1038.  
  1039. TRAK ::= "TRAK" #{  SEvent*   }
  1040.  
  1041. InstrForm ::= "FORM" #{  ...  }
  1042.  
  1043. The token "#" represents a ckSize LONG count of the following {braced} 
  1044. data bytes. Literal items are shown in "quotes", [square bracket items] 
  1045. are optional, and "*" means 0 or more replications. A sometimes-needed 
  1046. pad byte is shown as "[0]".
  1047.  
  1048. Actually, the order of chunks in a FORM SMUS is not as strict as this 
  1049. regular expression indicates. The SHDR, NAME, Copyright, AUTH, IRev, 
  1050. ANNO, and INS1 chunks may appear in any order, as long as they precede 
  1051. the TRAK chunks.
  1052.  
  1053. The chunk RInstrFormS represents any kind of instrument data FORM 
  1054. embedded in the FORM SMUS. For example, see the document "8SVX" IFF 
  1055. 8-Bit Sampled Voice. Of course, a recipient program will ignore an 
  1056. instrument FORM if it doesn't recognize that FORM type.
  1057.  
  1058.  
  1059. `0C
  1060. Appendix B. SMUS Example
  1061.  
  1062. Here's a box diagram for a simple example, a SMUS with two instruments 
  1063. and two tracks. Each track contains 1 note event and 1 rest event.
  1064.  
  1065.  
  1066.  
  1067.      +-----------------------------------------+  ------
  1068.      |'FORM'        94               |         ^
  1069.      |    +-----------------------------------+  |       |
  1070.      |  |'SMUS'                        |  |         |
  1071.      |  +-----------------------------------+  |    |
  1072.      |    | +-------------------------------+ |  |       |
  1073.      |    | | 'SHDR'     4           | |  |         |
  1074.      |    | | 12800, 127, 2          | |  |    |
  1075.      |    | +-------------------------------+ |  |       |
  1076.      |    | +-------------------------------+ |  |       |
  1077.      |    | | 'NAME'     10             | |  |      |
  1078.      |    | | 'Fugue in C'           | |  |    |
  1079.      |    | +-------------------------------+ |  |       |
  1080.      |    | +-------------------------------+ |  |       
  1081.      |    | | 'INS1'     9              | |  |      (94 bytes)
  1082.      |    | | 1,0,0,0,'piano'        | |  |     
  1083.      |    | +-------------------------------+ |  |       |
  1084.      |    | 0                     |  |    |
  1085.      |    | +-------------------------------+ |  |       |
  1086.      |    | | 'INS1'     10             | |  |      |
  1087.      |    | | 2,0,0,0,'guitar'            | |  |    |
  1088.      |    | +-------------------------------+ |  |       |
  1089.      |    | +-------------------------------+ |  |       |
  1090.      |    | | 'TRAK'     4              | |  |      |
  1091.      |    | | 60, 16, 128, 16        | |  |    |
  1092.      |    | +-------------------------------+ |  |       |
  1093.      |    | +-------------------------------+ |  |       |
  1094.      |    | | 'TRAK'     4              | |  |      |
  1095.      |    | | 128, 16, 60, 16        | |  |    |
  1096.      |    | +-------------------------------+ |  |       |
  1097.      |    +-----------------------------------+  |       V
  1098.      +-----------------------------------------+  -----
  1099.        
  1100.  
  1101. `0C
  1102. Appendix B. Standards Committee
  1103.  
  1104. The following people contributed to the design of this IFF standard:
  1105.  
  1106. Bob "Kodiak" Burns, Commodore-Amiga
  1107. R. J. Mical, Commodore-Amiga
  1108. Jerry Morrison, Electronic Arts
  1109. Greg Riker, Electronic Arts
  1110. Steve Shaw, Electronic Arts
  1111. Barry Walsh, Commodore-Amiga
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.  
  1127.  
  1128.  
  1129.  
  1130.  
  1131.  
  1132. The "0" after the first INS1 chunk is a pad byte.
  1133.  
  1134.  
  1135. `0C
  1136. Appendix C. Standards Committee
  1137.  
  1138. The following people contributed to the design of this SMUS standard:
  1139.  
  1140. Ralph Bellafatto, Cherry Lane Technologies
  1141. Geoff Brown, Uhuru Sound Software
  1142. Steve Hayes, Electronic Arts
  1143. Jerry Morrison, Electronic Arts
  1144.  
  1145.